package com.ssm.service.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ssm.dao.mapper.StudentManagerDaoMapper;
import com.ssm.pojo.Student;
import com.ssm.service.StudentManagerService;
@Service
public class StudentManagerServiceImpl implements StudentManagerService {
@Autowired
		private SqlSession sqlsession;
	@Override
	public void addStu(Student student) {
		StudentManagerDaoMapper studentManagerDaoMapper = sqlsession.getMapper(StudentManagerDaoMapper.class);
		studentManagerDaoMapper.addStu(student);
	}

	@Override
	public void delStu(Integer stuId) {
		StudentManagerDaoMapper studentManagerDaoMapper = sqlsession.getMapper(StudentManagerDaoMapper.class);
		studentManagerDaoMapper.delStu(stuId);

	}

	@Override
	public void updStu(Student student) {
		StudentManagerDaoMapper studentManagerDaoMapper = sqlsession.getMapper(StudentManagerDaoMapper.class);
		studentManagerDaoMapper.updStu(student);

	}

	@Override
	public List<Student> findAllStu() {
		StudentManagerDaoMapper studentManagerDaoMapper = sqlsession.getMapper(StudentManagerDaoMapper.class);
		List<Student> students = studentManagerDaoMapper.findAllStu();
		return students;
	}

	@Override
	public Student getStu(Integer stuId) {
		StudentManagerDaoMapper studentManagerDaoMapper = sqlsession.getMapper(StudentManagerDaoMapper.class);
		Student student = studentManagerDaoMapper.getStu(stuId);
		return student;
	}
	

}
